home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / gfx / flood_it.lha / Flood_It < prev   
Text File  |  1995-08-04  |  1KB  |  88 lines

  1. /*  Copyright © Krzysztof Sporysz vel Kivi
  2.     Poland -> Cracow
  3.     $Ver 2.0 22-Jul-95 21:53
  4. */
  5.  
  6. OPTIONS RESULTS
  7.  
  8. GetRegionArea
  9. IF result = "" THEN EXIT
  10. PARSE VAR result startx starty width height
  11.  
  12. Region FULL
  13.  
  14. endx = startx + width
  15. endy = starty + height
  16.  
  17. ActiveColor 1
  18. GetPalette 1
  19. color = result
  20.  
  21. IF width > height THEN
  22.     cnt = height / 2
  23. ELSE
  24.     cnt = width / 2
  25.  
  26. BeginBar 'Remove' width*height+10
  27. points = 0
  28. Message 'Removing points. Wait.'
  29. DO i = 0 TO cnt
  30.     xs = startx + i
  31.     xe = endx - i
  32.     ys = starty + i
  33.     ye = endy - i
  34.     points = points+(2*(xe-xs)+2*(ye-ys)-4)
  35.     Bar points
  36.     y = ys
  37.     DO x = xs TO xe
  38.          CALL WhatIs
  39.     END
  40.     x = xe
  41.     DO y = ys+1 TO ye
  42.          CALL WhatIs
  43.     END
  44.     y = ye
  45.     DO x = xe-1 TO xs BY -1
  46.          CALL WhatIs
  47.     END
  48.     x = xs
  49.     DO y = ye-1 TO ys+1 BY -1
  50.          CALL WhatIs
  51.     END
  52. END
  53. Redraw
  54. EndBar
  55. EXIT
  56. WhatIs:
  57.     GetPixel x y
  58.     IF result = color THEN DO
  59.         rl = 0
  60.         g = 0
  61.         bl = 0
  62.         c = 0
  63.         a = x ; b = y-1
  64.         CALL AddPixel
  65.         a = x ; b = y+1
  66.         CALL AddPixel
  67.         a = x+1 ; b = y
  68.         CALL AddPixel
  69.         a = x-1 ; b = y
  70.         CALL AddPixel
  71.         rl = rl / c
  72.         g = g / c
  73.         bl = bl / c
  74.         PutPixel x y rl g bl
  75.     END
  76. RETURN
  77. AddPixel:
  78.     GetPixel a b
  79.     IF result ~= color THEN DO
  80.         point = result
  81.         PARSE VAR point pr pg pb
  82.         rl = rl + pr
  83.         g = g + pg
  84.         bl = bl + pb
  85.         c = c + 1
  86.     END
  87. RETURN
  88.